'use strict';

module.exports = app => {
  const { STRING, INTEGER, DATE, BOOLEAN } = app.Sequelize;

  const Goods = app.model.define('good', {
    id: { type: INTEGER, primaryKey: true, autoIncrement: true },
    sku: { type: STRING(255), comment: '商品SKU', unique: true },
    materialsCode: { type: STRING(255), comment: '商品料件号', field: 'materialsCode' },
    hscode: { type: STRING(30), comment: '商品海关编码' },
    title: { type: STRING(30), comment: '商品名称' },
    model: { type: STRING(255), comment: '商品型号' },
    goodsIdUnit: { type: STRING(10), comment: '商品料件号对应计量单位', field: 'goodsIdUnit' },
    skuUnit: { type: STRING(10), comment: '商品SKU对应计量单位', field: 'skuUnit' },
    ratio: { type: STRING(10), comment: '商品SKU对应商品料件号数量换算比例' },
    unit1: { type: STRING(10), comment: '法定单位' },
    unit2: { type: STRING(10), comment: '第二单位' },
    description: STRING(200),
    status: BOOLEAN,
    created_at: DATE,
    updated_at: DATE,
  });

  return Goods;
};
